export default {
  namespaced: true,
  state: {
    articles: []
  },
  getters: {},
  mutations: {
    SET_ARTICLES(state, data) {
      state.articles = data;
    }
  },
  actions: {
    getArticlesData({ commit }) {
      fetch("http://localhost:3000/articles")
        .then(r => r.json())
        .then(function(myJson) {
          // console.log(myJson);
          commit("SET_ARTICLES", myJson);
        });
    }
  }
};
